#include <iostream>
#include <vector>
using namespace std;

int numRabbits(vector<int>& answers) {
    int cnt[1000] = {};
    for(int i=0;i<answers.size();i++){
        cnt[answers[i]]++;
    }

    int ans = 0;
    ans += cnt[0];
    for(int i=1;i<1000;i++){
        if(cnt[i] == 0) continue;
        if(cnt[i] % (i+1) == 0) ans += cnt[i];
        else ans += (cnt[i] / (i+1) * (i+1) + i + 1);
    }
    return ans;
}

int main(){
    vector<int> answers{1,1,2};
    int a = numRabbits(answers);
    cout << a << endl;
    return 0;
}